Show:

CGSGDimension Class

Extends CGSGVector2D
Module: Util

A Dimension object

Constructor

CGSGDimension
(
  • width
  • height
)
Parameters:

Methods

add
(
  • vector
)
public

add to this vector, the value passed in parameter

Parameters:
copy () CGSGDimension

Inherited from CGSGVector2D but overwritten in src\utils\class.region.js:226

Return a new object with these attributes

Returns:
divide
(
  • vector
)
public

divide to this vector, the value passed in parameter

Parameters:
divideByFloat
(
  • f
)
public

Divide x and y by f

Parameters:
getDistance
(
  • vector
)
Number public

Compute the euclidian distance between this vector and the one passe in parameter

Parameters:
Returns:
getLength () Number public
Returns:
getSquaredLength () Number public
Returns:
multiply
(
  • vector
)
public

multiply to this vector, the value passed in parameter

Parameters:
multiplyByFloat
(
  • f
)
public

Multiply x and y by f

Parameters:
normalize () public

Normalize this vector

resizeBy
(
  • widthFactor
  • heightFactor
)

Multiply current dimension by these new ones

Parameters:
resizeTo
(
  • newWidth
  • newHeight
)

Replace current dimension by these new ones

Parameters:
resizeWith
(
  • width
  • height
)

Increase/decrease current dimension with adding values

Parameters:
rotate
(
  • angle
)
public

rotate this vector around its origin

Parameters:
substract
(
  • vector
)
public

substract to this vector, the value passed in parameter

Parameters:

Properties

height Number

Alias to the y attribute

width Number

Alias to the x attribute